int countOnBits(unsigned int n) {
    int count = 0;
    while (n) 
    {
      
      count = count +  (n & 0x1 );
      n =  n>> 1;
    }
    return count;
}

int countOnBitsOpt1(unsigned int n) {
    int count = 0;
    while (n) 
    {
      ++count; 
      n =  n & (n-1);
    }
    return count;
}

static char preComputedLookUp[256] ;

int countBitsPreCompute (unsigned int n)  {
  return preComputedLookUp[n  & 0xFF]
      +  preComputedLookUp[(n >>  8 ) & 0xFF]
      +  preComputedLookUp[(n >> 16) & 0xFF]
      +  preComputedLookUp[(n >> 24)& 0xFF] ;
}


int main()
{

  //cout<<countOnBits(8)<<endl;
  for (int i=0; i < 256; ++i)
  {
	preComputedLookUp[i] = countOnBitsOpt1(i);
  }
  cout<<countBitsPreCompute(198)<<endl;
}